﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>批处理</title>
    <meta charset="UTF-8" />
    <script src="../WF/Scripts/QueryString.js"></script>
    <script src="../WF/Scripts/jquery/jquery.min.js" type="text/javascript"></script>
    <script src="../WF/Scripts/jquery/jquery.cookie.js" type="text/javascript"></script>
    <link href="../WF/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../WF/Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
    <link href="skin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="skin/css/animate.css" rel="stylesheet" type="text/css" />
    <!-- 引入ccbpm 的sdk开发js.  -->
    <script src="../WF/config.js" type="text/javascript"></script>
    <script src="../WF/Dev2Interface.js" type="text/javascript"></script>
    <style>
        .bd-callout-info{
            font-size:13px;
        }
        #flow-name {
            display: flex;
            justify-content: space-between;
            background: #d9edf7;
            color: #31708f;
        }
    </style>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            //节点为空的时候，列出节点列表,  获取当前用户批处理的流程及对应的节点
            var data = Batch_Init();
            if (data.indexOf("err@") != -1) {
                alert(data);
                return;
            }

            if (data.length == 0) {
                $("#lists").append("<center> 当前没有批处理的工作。 </center>");
                return;
            }

            var listbox = "<div class='row row-cols-3'>";
            //循环显示批处理的流程节点数量
            for (var idx = 0; idx < data.length; idx++) {

                var en = data[idx];
                console.log(en);

                var url = "";
                url = "./WorkOpt/Batch/BatchList.htm?FK_Node=" + en.NodeID;

                //审核组件模式.
                if (en.BatchRole == 1)
                    url = "./WorkOpt/Batch/WorkCheckModel.htm?FK_Node=" + en.NodeID;

                //审核分组模式.
                if (en.BatchRole == 2)
                    url = "./WorkOpt/Batch/GroupFieldModel.htm?FK_Node=" + en.NodeID;

                //自定义url模式.
                if (en.BatchRole == 3)
                    url = "javascript:ToSelfUrl(" + en.NodeID + ");";
                listbox += `<div class="panel-body">
                                <li class="item_hover"> <a href='${url}'>${en.Name}</a> &nbsp;<span class="badge label label-danger">${en.NUM}</span></li>
                                </div> `
                //listbox += "<li class='col-3' style='list-style-type:square; color:#959595;'><a href='" + url + "'  style=\"text-decoration:none; font-size:14px; font-weight:normal;\">" + en.FlowName + " --> " + en.Name + "(" + en.NUM + ")" + "</a></li><br/>";
            }
        /*    listbox += '';*/
            $("#lists").append(listbox);
        });

        function ToSelfUrl(nodeID) {
            var node = Node(nodeID);
            var url = GetPara("BatchSelfUrl", node.AtPara);
            console.log("node数据:" + nodeID);
            console.log("url地址链接" + url );
            if (url == undefined)
            {
                alert("没有定义 BatchSelfUrl 参数. ");
                return;
            }

            if (url.indexOf('?') == -1)
                url = url + "?NodeID=" + nodeID + "&FlowNo=" + node.FK_Flow;
            else
                url = url + "&NodeID=" + nodeID + "&FlowNo=" + node.FK_Flow;
            window.location.href = url;
        }
        //显示隐藏
        function GroupBarClick(groupName) {

            var alt = document.getElementById('flow-toggle').alert;
            var sta = 'block';
            if (alt == 'Max') {

                sta = 'block';
                alt = 'Min';
                classname = 'fa fa-chevron-down';
                $("#lists").show();

            } else {
                sta = 'none';
                alt = 'Max';
                classname = 'fa  fa-chevron-up';
                $("#lists").hide();
            }

            document.getElementById('flow-toggle').className = classname;
            document.getElementById('flow-toggle').alert = alt;
        }
    </script>
    <style type="text/css">
        .panel-body {
            margin-left: 20px;
        }

        .bd-callout {
            padding: 1.25rem;
            margin-top: 1.25rem;
            margin-bottom: 1.25rem;
            border: 1px solid #eee;
            border-left-width: .25rem;
            border-radius: .25rem;
            background: #fff;
        }

        .bd-callout-info {
            border-left-color: #5bc0de;
        }
        /* 批处理  */
        .item_hover>a:hover {
            color: #337ab7;
            text-decoration: none;
        }
    </style>
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <fieldset>
            <!--            <legend> 请选择要批处理的节点 </legend>-->
            <!--<div class="bd-callout bd-callout-info">
                请选择要批处理的节点
            </div>-->
            <div class="row c" style="margin-top:10px;">
                <div class="col-sm-12" style="padding-right: 45px;">
                    <div class="panel panel-info">
                        <!--<div class="panel-heading fa fa-chevron-down" alert='Min' id="flow-name" onclick="GroupBarClick()">批处理流程</div>-->
                        <div  class="panel-heading" id="flow-name">批处理流程 <span class="fa fa-chevron-down" alert='Min' id="flow-toggle" onclick="GroupBarClick()"></span> </div>
                        <div id="lists"></div>
                    </div>
                </div>
            </div>
        </fieldset>

    </div>
</body>
</html>
